package com.hisense.ovcloud.mqtt.business.config;

import java.util.Map;

public class Constants {
    public final static String REST_SCHEMA_HTTP = "http://";
    public final static String SUPER_ACCOUNT = "999999999999999";

    public final static int STATUS_ONLINE = 1;
    public final static int STATUS_OFFLINE = 2;

    public final static String STATUS_ONLINE_PAYLOAD = "{\"status\":1}";
    public final static String STATUS_OFFLINE_PAYLOAD = "{\"status\":2}";

    public final static String ONLINE_REDIS_PREFIX = "MQTT#";
    public final static String REDIS_NULL_VALUE = "REDIS_NULL_VALUE";
    public final static String EMQX_REST_URL = "http://emqx:8081/api/v4/clients?clientid=";

    public static class warehouse {
        public final static int ACTIVATED = 2;
        public final static int NOT_ACTIVATED = 1;
    }

    public static class DS {
        public final static String PRODUCT = "product";
        public final static String WAREHOUSE = "warehouse";
        public final static String PLATFORM = "platform";
    }

    public static String ENDPOINT_NAME_PATTHEN = "(?<MajorDomainID>\\d+)/(?<SubDomainID>\\d+)/(?<PhysicalID>[0-9a-zA-Z]+)_(?<SecureMode>\\d+)_(?<SignMethod>\\d+)_(?<Timestamp>\\d+)";

    public static String SQL_TEMP = "select k.access_key, k.secret_key, k.developer_id, i.major_domain from tbl_domain_info i left join tbl_key_info k on i.developer_id = k.developer_id where i.id = ? order by k.id asc limit 1;";

    public static class Responses {

        public static class AuthResult {
            public final static int Success = 0;
            public final static int InvalidClientId = 1;
            public final static int Unauthorized = 2;
        }
    }

    public static class ClientEp {
        public static class SignMethod{
            public final static String HmacMD5 = "1";
            public final static String HmacSHA1 = "2";
            public final static String HmacSHA256 = "3";
        }
    }

    public static class ZC {
        public static class HEAHERS{
            public final static String HEADER_ZC_DOMAIN = "x-zc-major-domain-id";
            public final static String HEADER_ZC_SUBDOMAIN = "x-zc-sub-domain-id";
            public final static String HEADER_ZC_TIMEOUT = "X-Zc-Timeout";
            public final static String HEADER_ZC_DEVELOPER_ID = "x-zc-developer-id";
        }

        public static int ZC_HS_SESSION_KEY_LEN = 16;
    }

    public static class MQTT {
        public static class Topics{
            public final static String UPDATE_CON = "$queue/+/+/+/queueMode/updateCon/";
            public final static String UPDATE_GET_DKEY = "$queue/+/+/+/queueMode/updateGetDkey/";
            public final static String SET_R = "$queue/+/+/+/queueMode/setR/";
        }

        public static class API {
            public final static String Api_On_Update_Con = "updateCon";
            public final static String Api_On_Update_SetR = "setR";
            public final static String Api_On_Update_Ver = "updateVer";
            public final static String Api_On_Deviceline = "onDeviceOnline";
            public final static String Api_On_Notication = "onNotification";
            public final static String Api_On_Update_Get_Dkey = "updateGetDkey";
        }

        public static Map<Integer, String> MsgTransTypeMap = Map.of(1,"TT", 2, "Himit", 3, "All");

        public static class MsgTransTypes {
            public final static String TT = "TT";
            public final static String Himit = "Himit";
            public final static String All = "All";
        }

        public static class MsgTransTypesIntegerValue {
            public final static int TT = 1;
            public final static int Himit = 2;
            public final static int All = 3;
        }
    }
}
